package com.github.postsanf.yinian.view;

import android.os.Handler;
import android.os.Message;

public abstract class AutoScrollHandler extends Handler{
	 long  scroll_interval = 3000;//自动滚动时间间隔，默认值
	final static int messageId = 1000;
	@Override
	public void handleMessage(Message msg) {
		int what = msg.what;
		switch (what) {
		case messageId:
			scroll();
			sendMessage();
			break;

		default:
			break;
		}
		super.handleMessage(msg);
	}
	public long getScroll_interval() {
		return scroll_interval;
	}
	public void setScroll_interval(long scroll_interval) {
		this.scroll_interval = scroll_interval;
	}

	public void sendMessage(){
		removeMessages(messageId);
		sendEmptyMessageDelayed(messageId,scroll_interval);
	}
	abstract void scroll();

}
